home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / faq / wdj0497.zip / NELSON.ZIP / APR97.CPP
C/C++ Source or Header  |  1997-01-30  |  1KB  |  39 lines

  1. //
  2. // APR97.CPP
  3. //
  4. // Microsoft made major changes to their implementation
  5. // of the C++ standard library in their 4.2 release.
  6. // Unfortunately, some of the changes appear to have
  7. // broken existing classes.  For example, including the
  8. // vector header file in this program causes an attempt
  9. // to perform comparisons of CString objects to fail.
  10. //
  11. // In this particular example, I compile the program
  12. // from the command line using the following command:
  13. //
  14. //  CL /GX apr97.cpp mfc42.lib
  15. //
  16. // The compile fails with an error C2373, saying that
  17. // '!=" has been redefined with different type modifiers
  18. // Changing the arguments to foo() to be const fixes
  19. // the problem, as does removing the include of vector.
  20. //
  21. #include <afx.h>
  22. #include <iostream>
  23. #include <vector>
  24.  
  25. void foo( CString &s1, CString &s2 )
  26. {
  27.     if ( s1 != s2 )
  28.         cout << "Mismatch\n";
  29. }
  30.  
  31. main()
  32. {
  33.     CString a = "a";
  34.     CString b = "b";
  35.     foo( a, b );
  36.     foo( a, a );
  37.     return 1;
  38. }
  39.